import java.util.Scanner;

/**
 * 完全数
 * Created by JiaJia on 2019/4/1 0001.
 */
public class HuaWei036 {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        while (sc.hasNext()){
            int num=sc.nextInt();
            System.out.println(count(num));

        }
        sc.close();
    }

    private static int count(int number){
        int sum=1;
        int result=0;
        for (int i = 2; i <number; i++) {

            if (number%i==0){
                    sum+=i;

        }
            if (sum==number){
                result++;
            }
        }


        return result;

    }

}